﻿using CIS.Common.Dtos;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CIS.Common
{
    public class GlobalBuilder
    {
        public static ConcurrentDictionary<string, Type> EventTypes;


        private void GetEventTypes()
        {
            EventTypes = new ConcurrentDictionary<string, Type>();
            var assembly = typeof(IDtoEvent).Assembly;
            var types = assembly.GetTypes();
            foreach (var t in types)
            {
                var eventName = t.Name.Replace("Dto", "");
                if (typeof(IDtoEvent).IsAssignableFrom(t))
                {
                    EventTypes[eventName] = t;
                }
            }
        }
    }
}
